
<?php include './application/views/top.php'; ?>
<script src="/resource/js/circle-progress.js"></script>
<script type="text/javascript" src="/static/js/formCheck.js"></script>


<div class="clear h50"></div>
<div class="layout kj">
	<form name="fastForm" id="fastForm" >
	<input type="hidden" id="ftype" name="ftype" value="<?php echo $ftype;?>">    
	<dl>
		<dt>
			<i class="t1"><img src="/resource/images/shu_line.png" width="5" height="25"></i>
            <h3>填写抵押借款信息</h3>
		</dt>
		<dd>
			<ul>
				<li>
					<span>有无抵押：</span>
					<?php foreach($borrow_fast_mortgage as $key=>$value){?>
					<input class="yuan" type="radio" id="mortgage" name="mortgage" checked="checked"  value="<?php echo $key;?>"><i style="margin-right:20px;"><?php echo $value;?></i>
					<?php }?>
				</li>
				<li style="width:828px">
					<span>抵押物：</span>
					<?php foreach($borrow_fast_diya as $key=>$value){?>
					<input class="yuan" type="radio" id="diya" name="diya" checked="checked" value="<?php echo $key;?>"><i style="margin-right:20px;"><?php echo $value;?></i>
					<?php }?>
				</li>
				<li style="width:740px">
					<span>个人资料：</span>
					<select class="pubput" id="ddlage" name="ddlage" style="margin-right:20px;"><?php foreach($borrow_fast_ddlage as $key=>$value){?><option value="<?php echo $key;?>"><?php echo $value;?></option><?php }?></select>
					<select class="pubput" id="ddlincome" name="ddlincome" style="margin-right:20px;"><?php foreach($borrow_fast_ddlturnover as $key=>$value){?><option value="<?php echo $key;?>"><?php echo $value;?></option><?php }?></select>
					<select class="pubput" id="ddlindustry" name="ddlindustry" style="margin-right:20px;"><?php foreach($borrow_fast_ddlindustry as $key=>$value){?><option value="<?php echo $key;?>"><?php echo $value;?></option><?php }?></select>
					<select class="pubput" id="ddloccupation" name="ddloccupation"><?php foreach($borrow_fast_ddloccupation as $key=>$value){?><option value="<?php echo $key;?>"><?php echo $value;?></option><?php }?></select>
				</li>
				<li class="w458">
					<span>企业介绍：</span>
					<select class="pubput" id="ddlturnover" name="ddlturnover" style="margin-right:20px;"><?php foreach($borrow_fast_ddlturnover as $key=>$value){?><option value="<?php echo $key;?>"><?php echo $value;?></option><?php }?></select>
					<select class="pubput" id="ddlstaff" name="ddlstaff"><?php foreach($borrow_fast_ddlstaff as $key=>$value){?><option value="<?php echo $key;?>"><?php echo $value;?></option><?php }?></select>
				</li>
				<li>
					<span>联系人：</span>
                    <input class="pubinput miaob" id="txtcontact" name="txtcontact">
				</li>
				<li>
					<span>性别：</span>
					<?php foreach($borrow_fast_sex as $key=>$value){?>
					<input class="yuan" type="radio" id="sex" name="sex" checked="checked" value="<?php echo $key;?>"><i style="margin-right:20px;"><?php echo $value;?></i>
					<?php }?>
				</li>
				<li>
					<span>联系电话：</span>
                    <input class="pubinput miaob" id="txttelephone" value="" name="txttelephone">
				</li>
				<li class="line">
					<span>贷款说明：</span>
                    <textarea id="txtremark" name="txtremark" style="width:1000px;height:150px;" class="bian"></textarea>
				</li>
			</ul>
		</dd>
	</dl>
    <div class="clear h20"></div>
    <div style="margin:50px auto;width:300px;"><input type="button" value="立即申请" class="button blue" onclick="fastSubmit()"></div>
    <div class="clear h20"></div>
</div>
<div class="clear h50"></div>
<?php include "./application/views/footer.php";?>
<script type="text/javascript">
    $(function($){
        if($("input[name='mortgage']:checked").val() == "无") {
            $("input[name='diya']").attr("disabled","true");
        }
    });
    $("input[name='mortgage']").click(function(){
        var value = $("input[name='mortgage']:checked").val();
        if(value == "无") {
            $("input[name='diya']").attr("disabled","true");
        } else if(value == "有") {
            $("input[name='diya']").removeAttr("disabled");
        }
    });

function fastSubmit(){
	var options = {
		url : '/borrow/fast_add/',
		//clearForm :true,
		//resetForm :true,
		beforeSubmit:  checkForm,
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg==''){
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					close: function() {
						location=ret.url;
					}
				}); 
				$("#msg").html("操作成功");
			}else{
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					close: function() {
						location=ret.url;
					}
				}); 
				$("#msg").html(ret.msg);
			}
		}
	};
	$("#fastForm").ajaxSubmit(options);
	return false;
}

function checkForm(){
	var err = '';
	if(IsChinese($('#txtcontact').val())==false){
		err = '请填写有效的联系人';
	}else if($('#txttelephone').val()==''){
		err = '请填写有效的电话号码';
	}
	
	if(err==''){
		return true;
	}else{
		$('#dialog').dialog({
			modal:true, //蒙层（弹出会影响页面大小）
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}}
		}); 
		$("#msg").html(err);
		return false;
	}
}
</script>